import {validationResult} from 'express-validator'
import {Result} from '../config/Result.js'
import  type {Request, Response} from 'express'

export function handleExpressValidate(req: Request, res: Response): boolean {
	const validResult = validationResult(req);
	if (!validResult.isEmpty()) {
		res.send(Result.validateFail({ errors: validResult.array() }));
		return false;
	}
  return true;
}
